package TCP4;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.*;
import java.util.logging.Handler;

public class Receive {
    public static void main(String[] args) throws IOException {
        System.out.println("服务端启 动");
        ServerSocket server = new ServerSocket(8080);

        while(true){
            Socket s=server.accept();
            System.out.println("客户端上线了，ip："+s.getInetAddress().getHostAddress());
            ExecutorService ex=new ThreadPoolExecutor(3,10,10, TimeUnit.SECONDS,
                    new ArrayBlockingQueue<Runnable>(100), Executors.defaultThreadFactory(),
                    new ThreadPoolExecutor.AbortPolicy());
            ex.execute(new Mythread(s));
        }
    }
}
